package transport

import (
	"addsvc/internal/middleware"
	"addsvc/internal/utils/method"

	kitendpoint "github.com/go-kit/kit/endpoint"
	"github.com/go-kit/log"
	"go.opentelemetry.io/otel/trace"
)

func makeEndpoint(end kitendpoint.Endpoint, method method.Method, logger log.Logger, tracer trace.Tracer) kitendpoint.Endpoint {

	end = middleware.Chains(method, logger)(end)
	end = middleware.TraceEndpoint(
		tracer,
		string(method),
		trace.WithSpanKind(trace.SpanKindServer),
	)(end)

	return end
}
